package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveUploadTaskBag;
import com.hiultra.archive.service.IArchiveUploadTaskBagService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 转存档案袋Controller
 * 
 * @author paidaxing
 * @date 2024-07-24
 */
@RestController
@RequestMapping("/archive/ArchiveUploadTaskBag")
public class ArchiveUploadTaskBagController extends BaseController
{
    @Autowired
    private IArchiveUploadTaskBagService archiveUploadTaskBagService;

    /**
     * 查询转存档案袋列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveUploadTaskBag archiveUploadTaskBag)
    {
        startPage();
        List<ArchiveUploadTaskBag> list = archiveUploadTaskBagService.selectArchiveUploadTaskBagList(archiveUploadTaskBag);
        return getDataTable(list);
    }

    /**
     * 导出转存档案袋列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:export')")
    @Log(title = "转存档案袋", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveUploadTaskBag archiveUploadTaskBag)
    {
        List<ArchiveUploadTaskBag> list = archiveUploadTaskBagService.selectArchiveUploadTaskBagList(archiveUploadTaskBag);
        ExcelUtil<ArchiveUploadTaskBag> util = new ExcelUtil<ArchiveUploadTaskBag>(ArchiveUploadTaskBag.class);
        util.exportExcel(response, list, "转存档案袋数据");
    }

    /**
     * 获取转存档案袋详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(archiveUploadTaskBagService.selectArchiveUploadTaskBagById(id));
    }

    /**
     * 新增转存档案袋
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:add')")
    @Log(title = "转存档案袋", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveUploadTaskBag archiveUploadTaskBag)
    {
        return toAjax(archiveUploadTaskBagService.insertArchiveUploadTaskBag(archiveUploadTaskBag));
    }

    /**
     * 修改转存档案袋
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:edit')")
    @Log(title = "转存档案袋", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveUploadTaskBag archiveUploadTaskBag)
    {
        return toAjax(archiveUploadTaskBagService.updateArchiveUploadTaskBag(archiveUploadTaskBag));
    }

    /**
     * 删除转存档案袋
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:remove')")
    @Log(title = "转存档案袋", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(archiveUploadTaskBagService.deleteArchiveUploadTaskBagByIds(ids));
    }

    /**
     * 修改转入转出状态
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskBag:updateArchiveUploadTaskBagStatus')")
    @Log(title = "修改转入转出状态", businessType = BusinessType.UPDATE)
    @PostMapping("/updateArchiveUploadTaskBagStatus")
    public AjaxResult updateArchiveUploadTaskBagStatus(@RequestParam("ids") String[] ids, @RequestParam("status")String status) {
        return toAjax(archiveUploadTaskBagService.updateArchiveUploadTaskBagStatus(ids, status));
    }
}
